home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Mac OS / AIAT / Headers / Corpus / IAExtentCorpus.h < prev    next >
Encoding:
Text File  |  1998-04-16  |  2.4 KB  |  90 lines  |  [TEXT/CWIE]

  1. // IAExtentCorpus.h
  2. //    Copyright:    © 1998 by Apple Computer, Inc., all rights reserved.
  3. //
  4. // IAExtentCorpus represents a corpus that is a set of memory-resident strings. 
  5. // The actual body of the strings are maintained in the initial buffer managed by the client. 
  6. // The IAExtentDoc which is a subclass of the IADoc represents an extent of text (string) 
  7. // from the  corpus represented by IAExtentCorpus. 
  8. //
  9.  
  10. #pragma once
  11. #ifndef IAExtentCorpus_h
  12. #define IAExtentCorpus_h
  13.  
  14. #pragma import on
  15. #if PRAGMA_STRUCT_ALIGN
  16.     #pragma options align=power
  17. #endif
  18.  
  19. #include "IACorpus.h"
  20.  
  21. #pragma IA_BEGIN_EXPORTS
  22.  
  23. const uint32    ExtentCorpusType = 'Ext0';
  24.  
  25. class RankedHit;
  26.  
  27. class IAExtentDoc : public IADoc {
  28. public:
  29.                 IAExtentDoc() : fText(NULL), fTextOffset(0), fLength(0), fExtentNumber(0), 
  30.                                 fRank(0), fGroupNumber(0), fHit(NULL) {}
  31.                 IAExtentDoc(const byte* buffer, uint32 offset, uint32 textLen, uint32 extentNumber,                 
  32.                         uint32 groupNumber, uint32 rank=0, RankedHit* hit = NULL);
  33.  
  34.     virtual        ~IAExtentDoc();
  35.     IAStorable*    DeepCopy() const;
  36.     uint32        StoreSize() const;
  37.     void        Store(IAOutputBlock* output) const;
  38.     IAStorable*    Restore(IAInputBlock* input) const;
  39.     bool        LessThan(const IAOrderedStorable* neighbor) const;
  40.     bool        Equal(const IAOrderedStorable* neighbor) const;
  41.     
  42.     byte*        GetText() const {return fText;}
  43.     uint32        GetLength() const {return fLength;}
  44.     uint32        GetOffset() const {return fTextOffset;}    
  45.     byte*        GetExtent() const;
  46.  
  47.     void         SetRank(uint32 rank) {fRank = rank;}
  48.     void        SetRankedHit(RankedHit* rh) {fHit = rh;}
  49.         
  50.     uint32        GetExtentNumber() const {return fExtentNumber;}
  51.     uint32         GetRank() const {return fRank;}
  52.     uint32        GetGroupNumber() const {return fGroupNumber;}
  53.     RankedHit*    GetRankedHit() const {return fHit;}
  54.     
  55. private:
  56.     byte*        fText;
  57.     uint32        fTextOffset;
  58.     uint32        fLength;
  59.     
  60.     uint32        fExtentNumber;
  61.     uint32        fRank;
  62.     uint32        fGroupNumber;
  63.     RankedHit*    fHit;
  64.  
  65. };
  66.  
  67. class IAExtentCorpus : public IACorpus {
  68. public:    
  69.                 IAExtentCorpus(uint32 corpType = ExtentCorpusType) : IACorpus(corpType) {fBuffer = NULL;}
  70.                 IAExtentCorpus(byte* buffer, uint32 corpType = ExtentCorpusType) : IACorpus(corpType) {fBuffer = buffer;}
  71.  
  72.     virtual        ~IAExtentCorpus() {}
  73.     
  74.     IADoc*        GetProtoDoc();
  75.     IADocText*    GetDocText(const IADoc* doc);    
  76.     byte*        GetBuffer() const {return fBuffer;}    
  77. private:
  78.     byte*        fBuffer;
  79. };
  80.  
  81.  
  82. #pragma IA_END_EXPORTS
  83.  
  84. #if PRAGMA_STRUCT_ALIGN
  85.     #pragma options align=reset
  86. #endif
  87.  
  88. #pragma import reset
  89. #endif
  90.